package Lambda;

import org.junit.Test;

public class LambdaExample {

    @Test
    public void test1(){

        System.out.println(operation(10,20, (x,y) -> x*y));
        System.out.println(operation(10,20, (x,y) -> x-y));
        System.out.println(operation(10,20, (x,y) -> x/y));
        System.out.println(operation(10,20, (x,y) -> Math.pow(x,y)));
    }

    public double operation(int x, int y, MyFun myFun){
        return myFun.fun(x,y);
    }

    @FunctionalInterface
    public interface MyFun{
        double fun(int a,int b);
    }
}
